package com.jxin.oms.order.interfaces.inorder.acl;

import cn.hutool.core.util.RandomUtil;
import com.jxin.oms.order.domain.inorder.acl.IGenerateIdAcl;
import org.springframework.stereotype.Service;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * 分布式id生成器 防腐层接口 实现
 * @author Jxin
 * @version 1.0
 * @since 2020/1/21 15:38
 */
@Service
public class GenerateIdAcl implements IGenerateIdAcl {
    private static final AtomicInteger nextInc = new AtomicInteger(RandomUtil.randomInt());
    @Override
    public String generateInOrderId() {
        return "test-in-" + nextInc.getAndIncrement();
    }
}
